<!DOCTYPE html>
<html>
	<head>
		<script type="text/javascript" src="libs/jquery.js"></script>
		<script type="text/javascript">
			$(function() {
				$("#notification").hide();
				$("#"+localStorage['sort']).attr("checked","on");
				if (localStorage['zs'] == "1")
					$("#zs").attr('checked',true);
				else
					$("#zs").attr('checked',false);
				//$("input[name='zs']:checked").val(localStorage['zs']);
				//$("input[name='dup']").val(localStorage['dup']);
				if (localStorage['dup'] == "1")
					$("#dup").attr('checked',true);
				else
					$("#dup").attr('checked',false);
				$("input[name='save']").click(saveOptions);
			});
			function saveOptions() {
				localStorage['sort']=$("input[name='sort']:checked").val();
				if ($("input[name='zs']:checked").val())
					localStorage['zs']="1";
				else
					localStorage['zs']="0";
				if ($("input[name='dup']:checked").val())
					localStorage['dup']="1";
				else
					localStorage['dup']="0";
				$("#notification").show()
				.fadeOut(2000);
			}
		</script>
	</head>
	<body>
		<h1 align="center">Torrent Search Options</h1>
		<div id="options">
			<table height="100%" width="100%" align="center">
				<tbody id="tablebody" vertical-align="middle">
					<tr>
						<td width="150">
							Sort options:
						</td>
						<td>
							<input type="radio" id="seed" name="sort" value="seed">Seeds&nbsp;&nbsp;
							<input type="radio" id="date" name="sort" value="date">Date&nbsp;&nbsp;
							<input type="radio" id="name" name="sort" value="name">Name&nbsp;&nbsp;
							<input type="radio" id="size" name="sort" value="size">Size
						</td>
					</tr>
					<tr>
						<td>Filter options:</td>
						<td>
							<input type="checkbox" id="zs" name="zs">
								Zero-Seeders &nbsp;&nbsp;
							<input type="checkbox" id="dup" name="dup">
								Duplicates &nbsp;&nbsp;
						</td>
					</tr>
					<tr>
						<td></td>
						<td>
							<input type="button" name="save" class="button" id="save_btn" value="Save"/>
						</td>
					</tr>
					<tr>
						<td colspan="2">
							<div id="notification"><h3><em>Options saved!</em></h3></div>
						</td>
					</tr>
				</tbody>
			</table>
			
		</div>
	</body>
</html>
